.class public Lcom/xiaomi/notes/AlertTimeSetting;
.super Ljava/lang/Object;
.source "AlertTimeSetting.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;
.implements Landroid/view/View$OnClickListener;


# instance fields
.field private btnDate:Landroid/widget/Button;

.field private calendar:Ljava/util/Calendar;

.field private config:Landroid/content/res/Configuration;

.field private context:Landroid/content/Context;

.field private main:Landroid/view/View;

.field private nCurrDay:I

.field private nCurrHour:I

.field private nCurrMin:I

.field private nCurrMonth:I

.field private nCurrWeek:I

.field private nCurrYear:I

.field private objInflater:Landroid/view/LayoutInflater;

.field private tpkDate:Landroid/widget/DatePicker;

.field private tpkTime:Landroid/widget/TimePicker;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 49
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 50
    iput-object p1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    .line 51
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v0

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->config:Landroid/content/res/Configuration;

    .line 52
    const-string v0, "layout_inflater"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->objInflater:Landroid/view/LayoutInflater;

    .line 53
    invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;

    move-result-object v0

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    .line 54
    return-void
.end method

.method static synthetic access$000(Lcom/xiaomi/notes/AlertTimeSetting;)Ljava/util/Calendar;
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    return-object v0
.end method

.method static synthetic access$100(Lcom/xiaomi/notes/AlertTimeSetting;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 19
    invoke-direct {p0}, Lcom/xiaomi/notes/AlertTimeSetting;->synTime()V

    return-void
.end method

.method static synthetic access$200(Lcom/xiaomi/notes/AlertTimeSetting;)Landroid/content/Context;
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$300(Lcom/xiaomi/notes/AlertTimeSetting;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrYear:I

    return v0
.end method

.method static synthetic access$400(Lcom/xiaomi/notes/AlertTimeSetting;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMonth:I

    return v0
.end method

.method static synthetic access$500(Lcom/xiaomi/notes/AlertTimeSetting;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrDay:I

    return v0
.end method

.method static synthetic access$600(Lcom/xiaomi/notes/AlertTimeSetting;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrWeek:I

    return v0
.end method

.method static synthetic access$700(Lcom/xiaomi/notes/AlertTimeSetting;)Landroid/widget/Button;
    .locals 1
    .parameter "x0"

    .prologue
    .line 19
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->btnDate:Landroid/widget/Button;

    return-object v0
.end method

.method private synTime()V
    .locals 2

    .prologue
    .line 139
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrYear:I

    .line 140
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x2

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMonth:I

    .line 141
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x5

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrDay:I

    .line 142
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x7

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrWeek:I

    .line 143
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/16 v1, 0xb

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrHour:I

    .line 144
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/16 v1, 0xc

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMin:I

    .line 145
    return-void
.end method


# virtual methods
.method public initRes(J)Lcom/xiaomi/notes/AlertTimeSetting;
    .locals 6
    .parameter "time"

    .prologue
    const/4 v4, 0x0

    const v3, 0x7f070001

    .line 57
    const-wide/16 v0, 0x0

    cmp-long v0, p1, v0

    if-lez v0, :cond_0

    .line 58
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    invoke-virtual {v0, p1, p2}, Ljava/util/Calendar;->setTimeInMillis(J)V

    .line 62
    :goto_0
    invoke-direct {p0}, Lcom/xiaomi/notes/AlertTimeSetting;->synTime()V

    .line 64
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->config:Landroid/content/res/Configuration;

    iget v0, v0, Landroid/content/res/Configuration;->orientation:I

    const/4 v1, 0x2

    if-ne v0, v1, :cond_1

    .line 65
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->objInflater:Landroid/view/LayoutInflater;

    const v1, 0x7f030001

    invoke-virtual {v0, v1, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    .line 67
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    invoke-virtual {v0, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/DatePicker;

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkDate:Landroid/widget/DatePicker;

    .line 68
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkDate:Landroid/widget/DatePicker;

    iget v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrYear:I

    iget v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMonth:I

    iget v3, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrDay:I

    invoke-virtual {v0, v1, v2, v3}, Landroid/widget/DatePicker;->updateDate(III)V

    .line 77
    :goto_1
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    const v1, 0x7f070002

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TimePicker;

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    .line 78
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TimePicker;->setIs24HourView(Ljava/lang/Boolean;)V

    .line 79
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    iget v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrHour:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TimePicker;->setCurrentHour(Ljava/lang/Integer;)V

    .line 80
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    iget v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMin:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TimePicker;->setCurrentMinute(Ljava/lang/Integer;)V

    .line 82
    return-object p0

    .line 60
    :cond_0
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->setTimeInMillis(J)V

    goto :goto_0

    .line 70
    :cond_1
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->objInflater:Landroid/view/LayoutInflater;

    const/high16 v1, 0x7f03

    invoke-virtual {v0, v1, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    .line 72
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    invoke-virtual {v0, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->btnDate:Landroid/widget/Button;

    .line 73
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->btnDate:Landroid/widget/Button;

    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    iget v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrYear:I

    iget v3, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMonth:I

    iget v4, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrDay:I

    iget v5, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrWeek:I

    invoke-static {v1, v2, v3, v4, v5}, Lcom/xiaomi/notes/Tools;->getDateYMDW(Landroid/content/Context;IIII)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    .line 74
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->btnDate:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    goto :goto_1
.end method

.method public onClick(Landroid/content/DialogInterface;I)V
    .locals 4
    .parameter "dialog"
    .parameter "which"

    .prologue
    const/4 v3, 0x2

    .line 97
    packed-switch p2, :pswitch_data_0

    .line 118
    .end local p0
    :goto_0
    return-void

    .line 99
    .restart local p0
    :pswitch_0
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->config:Landroid/content/res/Configuration;

    iget v0, v0, Landroid/content/res/Configuration;->orientation:I

    if-ne v0, v3, :cond_0

    .line 100
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x1

    iget-object v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkDate:Landroid/widget/DatePicker;

    invoke-virtual {v2}, Landroid/widget/DatePicker;->getYear()I

    move-result v2

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 101
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkDate:Landroid/widget/DatePicker;

    invoke-virtual {v1}, Landroid/widget/DatePicker;->getMonth()I

    move-result v1

    invoke-virtual {v0, v3, v1}, Ljava/util/Calendar;->set(II)V

    .line 102
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/4 v1, 0x5

    iget-object v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkDate:Landroid/widget/DatePicker;

    invoke-virtual {v2}, Landroid/widget/DatePicker;->getDayOfMonth()I

    move-result v2

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 104
    :cond_0
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/16 v1, 0xb

    iget-object v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    invoke-virtual {v2}, Landroid/widget/TimePicker;->getCurrentHour()Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 105
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    const/16 v1, 0xc

    iget-object v2, p0, Lcom/xiaomi/notes/AlertTimeSetting;->tpkTime:Landroid/widget/TimePicker;

    invoke-virtual {v2}, Landroid/widget/TimePicker;->getCurrentMinute()Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 107
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    invoke-virtual {v0}, Ljava/util/Calendar;->getTimeInMillis()J

    move-result-wide v0

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    cmp-long v0, v0, v2

    if-lez v0, :cond_1

    .line 108
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    check-cast v0, Lcom/xiaomi/notes/NoteEditActivity;

    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->calendar:Ljava/util/Calendar;

    invoke-virtual {v1}, Ljava/util/Calendar;->getTimeInMillis()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lcom/xiaomi/notes/NoteEditActivity;->runAlertServer(J)V

    goto :goto_0

    .line 110
    :cond_1
    iget-object v0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    const v1, 0x7f05005a

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Landroid/widget/Toast;->makeText(Landroid/content/Context;II)Landroid/widget/Toast;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    goto :goto_0

    .line 115
    :pswitch_1
    iget-object p0, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    .end local p0
    check-cast p0, Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {p0}, Lcom/xiaomi/notes/NoteEditActivity;->clearAlertServer()V

    goto :goto_0

    .line 97
    :pswitch_data_0
    .packed-switch -0x2
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public onClick(Landroid/view/View;)V
    .locals 6
    .parameter "v"

    .prologue
    .line 122
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 136
    :goto_0
    return-void

    .line 124
    :pswitch_0
    new-instance v0, Landroid/app/DatePickerDialog;

    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    new-instance v2, Lcom/xiaomi/notes/AlertTimeSetting$1;

    invoke-direct {v2, p0}, Lcom/xiaomi/notes/AlertTimeSetting$1;-><init>(Lcom/xiaomi/notes/AlertTimeSetting;)V

    iget v3, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrYear:I

    iget v4, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrMonth:I

    iget v5, p0, Lcom/xiaomi/notes/AlertTimeSetting;->nCurrDay:I

    invoke-direct/range {v0 .. v5}, Landroid/app/DatePickerDialog;-><init>(Landroid/content/Context;Landroid/app/DatePickerDialog$OnDateSetListener;III)V

    invoke-virtual {v0}, Landroid/app/DatePickerDialog;->show()V

    goto :goto_0

    .line 122
    :pswitch_data_0
    .packed-switch 0x7f070001
        :pswitch_0
    .end packed-switch
.end method

.method public show()V
    .locals 2

    .prologue
    .line 86
    new-instance v0, Landroid/app/AlertDialog$Builder;

    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->context:Landroid/content/Context;

    invoke-direct {v0, v1}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 87
    .local v0, dialog:Landroid/app/AlertDialog$Builder;
    const v1, 0x7f05005b

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;

    .line 88
    iget-object v1, p0, Lcom/xiaomi/notes/AlertTimeSetting;->main:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setView(Landroid/view/View;)Landroid/app/AlertDialog$Builder;

    .line 89
    const v1, 0x7f050006

    invoke-virtual {v0, v1, p0}, Landroid/app/AlertDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 90
    const v1, 0x7f050007

    invoke-virtual {v0, v1, p0}, Landroid/app/AlertDialog$Builder;->setNegativeButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 92
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;

    .line 93
    return-void
.end method
